/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jav;

import com.sun.lwuit.Command;
import com.sun.lwuit.Dialog;
import com.sun.lwuit.Label;
import com.jav.componentes.textfield.TextField;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;

/**
 *
 * @author Javier
 */
public class LoginDialog {

    public static String ShowInputBox(String Title, String Message) {
        final Dialog dlg = new Dialog(Title);

        Label lbl = new Label(Message);
        dlg.addComponent(lbl);

        TextField txtInput = new TextField();
        txtInput.setInputModeOrder(new String[]{"123"});
        txtInput.setUseSoftkeys(false);
        dlg.addComponent(txtInput);

        txtInput.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                dlg.dispose();
            }
        });

        Command cmdOK = new Command("Login");
        Command cmdCancel = new Command("Cancel");
        dlg.addCommand(cmdOK);
        dlg.addCommand(cmdCancel);

        Command cmd = dlg.showDialog();

        if (cmd == cmdOK) {
            return txtInput.getText();
        } else {
            return null;
        }

    }
}
